/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Builder;

import DAO.InformationFilter.UserDAO;
import Info.UserInfo;
import MySqlAccess.DataAcessHelper;
import MySqlAccess.User;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author tran tuan tai
 */
public class UsrBuilder
{
    public void Builder()
    {
        UserDAO userDAO = new UserDAO();
        userDAO.DoEmpty();

        DataAcessHelper.SetDatabaseName("baonhattin");
        DataAcessHelper.CreateConnection();
        MySqlAccess.User wpUser = new MySqlAccess.User();
        List<MySqlAccess.UserInfo> lstUser = wpUser.GetValidUser();
        
        List<UserInfo> userInfo = new ArrayList<UserInfo>();
        for (MySqlAccess.UserInfo info : lstUser)
        {
            UserInfo u = new UserInfo();
            u.id = info.id;
            u.registeredDate = info.registerDate;
            userInfo.add(u);
        }

        userDAO.Insert(userInfo);
    }

    public static void main(String[] argvs)
    {
        UsrBuilder userBuilder = new UsrBuilder();
        userBuilder.Builder();
    }
}
